/* eslint-disable */
import React from 'react';
import { Router, Route, Switch } from 'dva/router';
import dynamic from 'dva/dynamic';
import { LocaleProvider } from 'antd';
import zh_CN from 'antd/lib/locale-provider/zh_CN';
import 'moment/locale/zh-cn';

const routes = [
    {
        path: '/login',
        models: () => [import('./models/app')],
        component: () => import('./routes/login/Login.js'),
    },
    {
        path: '/Cockpit',
        models: () => [import('./models/app')],
        component: () => import('./routes/Cockpit/NoWasteCell'),
    },
    {
        path: '/App*',
        models: () => [import('./models/app')],
        component: () => import('./components/layout/App'),
    },
   
];



function RouterConfig({ history, app }) {
    return (
        <LocaleProvider locale={zh_CN}>
            <Router history={history}>
                <Switch>
                    {
                        routes.map(({ path, ...dynamics }, key) => (
                            <Route
                                key={path}
                                exact
                                path={path}
                                component={dynamic({
                                    app,
                                    ...dynamics,
                                })}
                            />
                        ))
                    }
                </Switch>
            </Router>
        </LocaleProvider>
    );
}

export default RouterConfig;
module.exports = RouterConfig;